package com.joker.aigc.jsonconvert.domain.enums;


import lombok.Getter;

/**
 * @description:
 * @author: feixiang.li
 * @date: 2025-01-24 17:09
 */
@Getter
public enum SqlExecuteTypeEnum {
    // 更新，插入，删除
    UPDATE("update"),
    INSERT("insert"),
    DELETE("delete");

    private final String type;

    SqlExecuteTypeEnum(String type) {
        this.type = type;
    }

    public String getType() {
        return type;
    }

    public static SqlExecuteTypeEnum getByType(String type) {
        for (SqlExecuteTypeEnum value : values()) {
            if (value.getType().equals(type)) {
                return value;
            }
        }
        return null;
    }

    public static boolean isUpdate(String type) {
        return UPDATE.getType().equals(type);
    }

    public static boolean isInsert(String type) {
        return INSERT.getType().equals(type);
    }

    public static boolean isDelete(String type) {
        return DELETE.getType().equals(type);
    }
}
